<template>
  <div class="createPost-container">
    <el-form class="form-container" :model="form" :rules="rules" ref="refForm" label-width="100px">
      <el-form-item label="域名类型" prop="type">
        <el-radio-group v-model="form.type" size="medium">
          <el-radio-button :label="0">PC域名</el-radio-button>
          <el-radio-button :label="1">手机域名</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="用户端类型" prop="type">
        <el-radio-group v-model="form.clientType" size="medium">
          <el-radio-button :label="0">会员</el-radio-button>
          <el-radio-button :label="2">代理</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="域名地址" prop="domain">
        <el-input type="textarea" :rows="1" class="article-textarea" autosize placeholder="请输入地址"
                  v-model="form.domain">
        </el-input>
        <!--<el-tip></el-tip>-->
      </el-form-item>
      <!-- <el-form-item label="域名类型" prop="actionUrl">
         <el-select v-model="consts.showClient">
          <el-option v-for="item in consts.DEVICE_TYPE_ACTIVE"
                     :key="item.value"
                     :label="item.title"
                     :value="item.value">
          </el-option>
        </el-select>
      </el-form-item> -->

      <el-button v-loading="loading" style="margin-left: 10px;" type="primary"
                 @click="doSave({
                 action: 'saveForm',
                 form: {
                 name: 'refForm',
                 scrollToError: true
                 }})">确定
      </el-button>
    </el-form>
  </div>
</template>

<script>
  import Tinymce from '@/components/Tinymce'
  import EditorImage from '@/components/Tinymce/components/editorImage'

  import {
    sysDomainAddApi as saveApi
  } from '@/services/api/marketing'

  import {form, factory} from '@/build'

  export default {
    name: 'domain-add',
    components: {
      // CheckboxAll,
      // Tinymce,
      // EditorImage,
    },

    mixins: [form],

    props: ['id','rowData'],
    data() {
      return {
        isIndeterminate: true,
        selectAll: false,
        position: undefined,
        form: {
          domain: '',
          type: 0,
          clientType: 0,
        },
        rules: {
          domain: factory.getRule('uri'),
        }
      }
    },
    methods: {

    },
    mounted() {
      this.bindSave(saveApi, 'saveForm', 'form', {
        afterSuccess: () => {
          this.$emit('on-success');
          this.form.domain = '';
            // this.$router.push({
            //   name: 'marketing-domain',
            //   replace: true,
            //   query: {
            //     tab: 'one'
            //   }
            // })

        }
      });
    },
  }
</script>

<style lang="scss" scoped>
  .image {
    width: 100px;
    height: 100px;
  }
</style>
